var app = getApp()
var util = require('../../utils/util.js')
var md5 = require('../md5.js');
Page({
  data: {
    screenWidth: app.globalData.screenWidth,
    bannerHeight: 252,
    currentTab: 0,
    showModal: false,
    luzsshow: false,
    cpMesg: [], //产品列表
    "bnrUrl": [{
      "url": "../../images/2.jpg"
    }, {
      "url": "../../images/2.jpg"
    }, {
      "url": "../../images/2.jpg"
    }],
    "productOne": [{
      "url": "../../images/2.jpg"
    }, {
      "url": "../../images/3.jpg"
    }, {
      "url": "../../images/2.jpg"
    }],
    "productTwo": [{
      "url": "../../images/3.jpg"
    }, {
      "url": "../../images/2.jpg"
    }, {
      "url": "../../images/2.jpg"
    }],
  },
  submit: function () {
    this.setData({
      showModal: true
    })
  },
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh({
      complete: (res) => {},
    });
  },
  //底部导航跳转
  toAiIndex: function () {
    util.toAiIndex()
  },
  toContactsIng: function () {
    util.toContactsIng()
  },
  toProductRevision: function () {
    util.toProductRevision()
  },
  toMy: function () {
    util.toMy()
  },
  preventTouchMove: function () {

  },
  toChangeShow: function () {
    var that = this
    that.setData({
      luzsshow: false
    })
  },
  toDetail: function (e) {
    var that = this;
    var tagid = e.currentTarget.dataset.tagid;
    console.log('tagid', tagid)
    wx.navigateTo({
      url: '../productModule/productDetails?productid=' + tagid,
    })
  },
  go: function () {
    this.setData({
      showModal: false
    })
  },
  onLoad: function (options) {
    // 页面初始化 options为页面跳转所带来的参数
    var that = this
    //设置语言0:中文，1：英文
    var setlanguage = wx.getStorageSync('setlanguage')
    if ((wx.getStorageSync('setlanguage') || !"".trim() == wx.getStorageSync('setlanguage'))) {
      this.setData({
        setlanguage: wx.getStorageSync('setlanguage')
      })
      if (setlanguage == 1) {
        wx.setNavigationBarTitle({
          title: 'Exhibitor Introduction'
        })
      } else {
        wx.setNavigationBarTitle({
          title: '展商介绍'
        })
      }
    } else {
      wx.setStorageSync('setlanguage', 0);
      this.setData({
        setlanguage: 0
      })
    }
    var exhibitorid = options.exhibitorid
    //  exhibitorid='34'
    console.log("exhibitorid=", exhibitorid)
    that.setData({
      exhibitorid: exhibitorid
    })
    var exhibitionid = wx.getStorageSync('exhibitionid')
    //  exhibitionid='33'
    var u = wx.getStorageSync('u')
    console.log('exhibitionid=' + exhibitionid)
    console.log('u=' + u)
    if ((wx.getStorageSync('exhibitionid') || !"".trim() == wx.getStorageSync('exhibitionid')) &&
      (wx.getStorageSync('u') || !"".trim() == wx.getStorageSync('u'))) {
      //默认最新（调用pico接口）
      var timestamp = Date.parse(new Date());
      timestamp = timestamp / 1000;
      var url = app.globalData.picoaddress + '/attendee/exhibitors/detail'
      var k = {}
      k["v"] = '1.0.0'
      k["client"] = 'ios'
      k["timestamp"] = timestamp
      k["lan"] = 'cn'
      k["exhibitionid"] = exhibitionid
      k["exhibitorid"] = exhibitorid
      k["u"] = u

      var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'exhibitorid' + exhibitorid + 'timestamp' + timestamp + app.globalData.picotoken
      console.log(sign)
      var curb64 = md5.hexMD5(sign)
      console.log(curb64)
      k["sign"] = curb64
      wx.request({
        header: {
          'content-type': 'application/x-www-form-urlencoded',
        },
        url: url,
        method: 'post',
        data: k,
        success(res) {
          console.log(res)
          var mesg = res.data
          console.log('mesg=' + mesg)
          var curdata = mesg.data
          console.log('curdata=', curdata)
          var crntBannerHeight = curdata.bannerheight / curdata.bannerwidth * that.data.screenWidth
          console.log('crntBannerHeight = ', crntBannerHeight)
          var toid = curdata.contactid
          console.log('toid=' + toid)
          var content = curdata.content + ''
          console.log('content=' + content)
          content = content.replace(/\<img/g, '<img class="img" style="width:50px!import;height:100px!import;display:"block"')
          console.log('thcontent=' + content)
          curdata.content = content
          that.setData({
            exhibitorMesg: curdata,
            bannerHeight: crntBannerHeight,
            toid: toid
          });
          //==============加载联系人fullname=========================
          var cururl = app.globalData.picoaddress + '/attendee/contacts/detail'
          var k = {}
          k["v"] = '1.0.0'
          k["client"] = 'ios'
          k["timestamp"] = timestamp
          k["lan"] = 'cn'
          k["exhibitionid"] = exhibitionid
          k["attendeeid"] = toid
          k["u"] = u
          var sign = app.globalData.picotoken + 'attendeeid' + toid + 'clientiosexhibitionid' + exhibitionid + 'timestamp' + timestamp + app.globalData.picotoken
          console.log(sign)
          var curb64 = md5.hexMD5(sign)
          console.log(curb64)
          k["sign"] = curb64
          wx.request({
            header: {
              'content-type': 'application/x-www-form-urlencoded',
            },
            url: cururl,
            method: 'post',
            data: k,
            success(res) {
              console.log(res)
              var mesg = res.data
              console.log('mesg=' + mesg)
              var curdata = mesg.data
              var fullname = curdata.fullname
              that.setData({
                fullname: fullname,
              });

            },
            fail: res => {
              console.log(res, "error")
            }
          })

        },
        fail: res => {
          console.log(res, "error")
        }

      })
      //产品介绍
      var cpurl = app.globalData.picoaddress + '/attendee/exhibitors/products'
      var m = {}
      m["v"] = '1.0.0'
      m["client"] = 'ios'
      m["timestamp"] = timestamp
      m["lan"] = 'cn'
      m["exhibitionid"] = exhibitionid
      m["exhibitorid"] = exhibitorid
      m["page"] = 1
      m["u"] = u

      var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'exhibitorid' + exhibitorid + 'page1' + 'timestamp' + timestamp + app.globalData.picotoken
      console.log(sign)
      var curb64 = md5.hexMD5(sign)
      console.log(curb64)
      m["sign"] = curb64
      wx.request({
        header: {
          'content-type': 'application/x-www-form-urlencoded',
        },
        url: cpurl,
        method: 'post',
        data: m,
        success(res) {
          console.log(res)
          var mesg = res.data
          console.log('mesg=' + mesg)
          var curdata = mesg.data
          console.log('curdata=', curdata)
          that.setData({
            cpMesg: curdata
          });
        },
        fail: res => {
          console.log(res, "error")
        }

      })
      //资料袋
      var zlurl = app.globalData.picoaddress + '/attendee/exhibitors/materials'
      var n = {}
      n["v"] = '1.0.0'
      n["client"] = 'ios'
      n["timestamp"] = timestamp
      n["lan"] = 'cn'
      n["exhibitionid"] = exhibitionid
      n["exhibitorid"] = exhibitorid
      n["u"] = u

      var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'exhibitorid' + exhibitorid + 'timestamp' + timestamp + app.globalData.picotoken
      console.log(sign)
      var curb64 = md5.hexMD5(sign)
      console.log(curb64)
      n["sign"] = curb64
      wx.request({
        header: {
          'content-type': 'application/x-www-form-urlencoded',
        },
        url: zlurl,
        method: 'post',
        data: n,
        success(res) {
          console.log(res)
          var mesg = res.data
          console.log('mesg=' + mesg)
          var curdata = mesg.data
          //是否存在展商资料,产品资料
          var sfczzszl = '0' //默认不存在
          //var zszlleg ='0'
          var sfczcpzl = '0'

          for (var i in curdata) {
            var categoryname = curdata[i].categoryname
            var zlleg = curdata[i].materials.length
            console.log('zlleg=' + zlleg)
            if (categoryname == '展商资料' && zlleg > 0) {
              sfczzszl = '1'
            }
            if (categoryname == '产品资料' && zlleg > 0) {
              sfczcpzl = '1'
            }
          }
          console.log('curdata=', curdata)
          console.log('sfczzszl=', sfczzszl)
          console.log('sfczcpzl=', sfczcpzl)
          that.setData({
            sfczzszl: sfczzszl,
            sfczcpzl: sfczcpzl,
            zlMesg: curdata
          });
        },
        fail: res => {
          console.log(res, "error")
        }

      })

    } else {
      wx.redirectTo({
        url: '../signInbyPhone/signIn'
      })
    }

  },
  //滑动切换
  swiperTab: function (e) {
    var that = this;
    that.setData({
      currentTab: e.detail.current
    });
  },
  onShareAppMessage: function (res) {
    var that = this
    let users = wx.getStorageSync('user');
    var exhibitorid = that.data.exhibitorid
    var fxid = res.target.id
    var curlb = (fxid.split('-'))[0]
    console.log('curlb=' + curlb)
    var curid = (fxid.split('-'))[1]
    console.log('curid=' + curid)
    if (res.from === 'button') {
      if (curlb == 'zs') {
        this.setData({
          showModal: false
        })
        return {
          title: '展商分享',
          path: 'pages/exhibitorModule/exhibitorsIntroduciton?exhibitorid=' + curid,
          success: function (res) {}
        }
      }
      if (curlb == 'cp') {
        return {
          title: '产品分享',
          path: 'pages/productModule/productDetails?productid=' + curid,
          success: function (res) {}
        }
      }
      if (curlb == 'zl') {
        return {
          title: '资料分享',
          path: 'pages/receiveInfo/receiveInfolj?urlmesg=' + curid,
          success: function (res) {}
        }
      }


    }

  },
  toaCurReceiveInfolj(e) {
    console.log(e)
    var urlmesg = e.currentTarget.dataset.urlmesg
    console.log('urlmesg=' + urlmesg)
    let url = encodeURIComponent(urlmesg)
    wx.navigateTo({
      url: '../vote/tpordy?urlmesg=' + url,
    })
  },
  toReceiveInfolj(e) {
    console.log(e)
    var urlmesg = e.currentTarget.dataset.urlmesg
    wx.navigateTo({
      url: '../receiveInfo/receiveInfolj?urlmesg=' + urlmesg,
    })
  },
  sczl(e) {
    console.log(e)
    var materialid = e.currentTarget.dataset.zlid
    var that = this
    var exhibitorid = that.data.exhibitorid
    var exhibitionid = wx.getStorageSync('exhibitionid')
    var u = wx.getStorageSync('u')
    console.log('exhibitionid=' + exhibitionid)
    console.log('u=' + u)
    //如果未登录收藏跳转登录
    if (!(exhibitionid == '0' && u == '0')) {
      //默认最新（调用pico接口）
      var timestamp = Date.parse(new Date());
      timestamp = timestamp / 1000;
      var url = app.globalData.picoaddress + '/attendee/materials/collect'
      var k = {}
      k["v"] = '1.0.0'
      k["client"] = 'ios'
      k["timestamp"] = timestamp
      k["lan"] = 'cn'
      k["exhibitionid"] = exhibitionid
      k["materialid"] = materialid
      k["u"] = u
      var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'materialid' + materialid + 'timestamp' + timestamp + app.globalData.picotoken
      console.log(sign)
      var curb64 = md5.hexMD5(sign)
      console.log(curb64)
      k["sign"] = curb64
      wx.request({
        header: {
          'content-type': 'application/x-www-form-urlencoded',
        },
        url: url,
        method: 'post',
        data: k,
        success(res) {
          console.log(res)
          if ((wx.getStorageSync('exhibitionid') || !"".trim() == wx.getStorageSync('exhibitionid')) &&
            (wx.getStorageSync('u') || !"".trim() == wx.getStorageSync('u'))) {
            //默认最新（调用pico接口）
            var timestamp = Date.parse(new Date());
            timestamp = timestamp / 1000;
            var url = app.globalData.picoaddress + '/attendee/exhibitors/detail'
            var k = {}
            k["v"] = '1.0.0'
            k["client"] = 'ios'
            k["timestamp"] = timestamp
            k["lan"] = 'cn'
            k["exhibitionid"] = exhibitionid
            k["exhibitorid"] = exhibitorid
            k["u"] = u

            var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'exhibitorid' + exhibitorid + 'timestamp' + timestamp + app.globalData.picotoken
            console.log(sign)
            var curb64 = md5.hexMD5(sign)
            console.log(curb64)
            k["sign"] = curb64
            wx.request({
              header: {
                'content-type': 'application/x-www-form-urlencoded',
              },
              url: url,
              method: 'post',
              data: k,
              success(res) {
                console.log(res)
                var mesg = res.data
                console.log('mesg=' + mesg)
                var curdata = mesg.data
                console.log('curdata=', curdata)
                that.setData({
                  exhibitorMesg: curdata
                });
              },
              fail: res => {
                console.log(res, "error")
              }

            })
          }
          //重新加载资料
          if ((wx.getStorageSync('exhibitionid') || !"".trim() == wx.getStorageSync('exhibitionid')) &&
            (wx.getStorageSync('u') || !"".trim() == wx.getStorageSync('u'))) {
            var zlurl = app.globalData.picoaddress + '/attendee/exhibitors/materials'
            var n = {}
            n["v"] = '1.0.0'
            n["client"] = 'ios'
            n["timestamp"] = timestamp
            n["lan"] = 'cn'
            n["exhibitionid"] = exhibitionid
            n["exhibitorid"] = exhibitorid
            n["u"] = u

            var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'exhibitorid' + exhibitorid + 'timestamp' + timestamp + app.globalData.picotoken
            console.log(sign)
            var curb64 = md5.hexMD5(sign)
            console.log(curb64)
            n["sign"] = curb64
            wx.request({
              header: {
                'content-type': 'application/x-www-form-urlencoded',
              },
              url: zlurl,
              method: 'post',
              data: n,
              success(res) {
                console.log(res)
                var mesg = res.data
                console.log('mesg=' + mesg)
                var curdata = mesg.data
                console.log('curdata=', curdata)
                that.setData({
                  zlMesg: curdata
                });
              },
              fail: res => {
                console.log(res, "error")
              }
            })
          }

        },
        fail: res => {
          console.log(res, "error")
        }

      })

    } else {
      wx.navigateTo({
        url: '../signInbyPhone/signIn'
      })
    }
  },
  sc: function () {
    var that = this
    var exhibitorid = that.data.exhibitorid
    var exhibitionid = wx.getStorageSync('exhibitionid')
    var u = wx.getStorageSync('u')
    console.log('exhibitionid=' + exhibitionid)
    console.log('u=' + u)
    //所有收藏判断
    if (!(exhibitionid == '0' && u == '0')) {
      //默认最新（调用pico接口）
      var timestamp = Date.parse(new Date());
      timestamp = timestamp / 1000;
      var url = app.globalData.picoaddress + '/attendee/exhibitors/collect'
      var k = {}
      k["v"] = '1.0.0'
      k["client"] = 'ios'
      k["timestamp"] = timestamp
      k["lan"] = 'cn'
      k["exhibitionid"] = exhibitionid
      k["exhibitorid"] = exhibitorid
      k["u"] = u
      var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'exhibitorid' + exhibitorid + 'timestamp' + timestamp + app.globalData.picotoken
      console.log(sign)
      var curb64 = md5.hexMD5(sign)
      console.log(curb64)
      k["sign"] = curb64
      wx.request({
        header: {
          'content-type': 'application/x-www-form-urlencoded',
        },
        url: url,
        method: 'post',
        data: k,
        success(res) {
          console.log(res)
          if ((wx.getStorageSync('exhibitionid') || !"".trim() == wx.getStorageSync('exhibitionid')) &&
            (wx.getStorageSync('u') || !"".trim() == wx.getStorageSync('u'))) {
            //默认最新（调用pico接口）
            var timestamp = Date.parse(new Date());
            timestamp = timestamp / 1000;
            var url = app.globalData.picoaddress + '/attendee/exhibitors/detail'
            var k = {}
            k["v"] = '1.0.0'
            k["client"] = 'ios'
            k["timestamp"] = timestamp
            k["lan"] = 'cn'
            k["exhibitionid"] = exhibitionid
            k["exhibitorid"] = exhibitorid
            k["u"] = u

            var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'exhibitorid' + exhibitorid + 'timestamp' + timestamp + app.globalData.picotoken
            console.log(sign)
            var curb64 = md5.hexMD5(sign)
            console.log(curb64)
            k["sign"] = curb64
            wx.request({
              header: {
                'content-type': 'application/x-www-form-urlencoded',
              },
              url: url,
              method: 'post',
              data: k,
              success(res) {
                console.log(res)
                var mesg = res.data
                console.log('mesg=' + mesg)
                var curdata = mesg.data
                console.log('curdata=', curdata)
                var crntBannerHeight = curdata.bannerheight / curdata.bannerwidth * that.data.screenWidth
                console.log('crntBannerHeight = ', crntBannerHeight)
                var toid = curdata.contactid
                console.log('toid=' + toid)
                var content = curdata.content + ''
                console.log('content=' + content)
                content = content.replace(/\<img/g, '<img class="img" style="width:50px!import;height:100px!import;display:"block"')
                console.log('thcontent=' + content)
                curdata.content = content
                that.setData({
                  exhibitorMesg: curdata,
                  bannerHeight: crntBannerHeight,
                  toid: toid
                });
              },
              fail: res => {
                console.log(res, "error")
              }

            })

          }
        },
        fail: res => {
          console.log(res, "error")
        }

      })

    } else {
      wx.navigateTo({
        url: '../signInbyPhone/signIn'
      })
    }
  },
  cpsc: function (e) {
    var that = this
    var product = e.currentTarget.dataset.tagid
    var productid = product.productid
    var exhibitionid = wx.getStorageSync('exhibitionid')
    var u = wx.getStorageSync('u')
    console.log('exhibitionid=' + exhibitionid)
    console.log('u=' + u)
    if (!(exhibitionid == '0' && u == '0')) {
      //默认最新（调用pico接口）
      var timestamp = Date.parse(new Date());
      timestamp = timestamp / 1000;
      var url = app.globalData.picoaddress + '/attendee/products/collect'
      var k = {}
      k["v"] = '1.0.0'
      k["client"] = 'ios'
      k["timestamp"] = timestamp
      k["lan"] = 'cn'
      k["exhibitionid"] = exhibitionid
      k["productid"] = productid
      k["u"] = u
      var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'productid' + productid + 'timestamp' + timestamp + app.globalData.picotoken
      console.log(sign)
      var curb64 = md5.hexMD5(sign)
      console.log(curb64)
      k["sign"] = curb64
      wx.request({
        header: {
          'content-type': 'application/x-www-form-urlencoded',
        },
        url: url,
        method: 'post',
        data: k,
        success(res) {
          console.log(res)
          // 更改状态
          product.collection = res.data.data.collection
          var newCpMesg = that.data.cpMesg
          for (let index = 0; index < newCpMesg.length; index++) {
            const element = newCpMesg[index];
            if (element.productid == productid) {
              element.collection = res.data.data.collection
              that.setData({
                cpMesg: newCpMesg
              })
              break
            }
          }
          wx.showToast({
            title: res.data.data.collection ? '收藏成功' : '取消收藏',
            icon: 'success',
            duration: 1000
          })
        },
        fail: res => {
          console.log(res, "error")
        }

      })

    } else {
      wx.navigateTo({
        url: '../signInbyPhone/signIn'
      })
    }
  },
  //点击切换
  clickTab: function (e) {
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTab: e.target.dataset.current
      })
    }
  },
  gb: function () {
    this.setData({
      showModal: false
    })
  },
  luzs: function () {
    var that = this;
    //获取缓存展会id和用户id存在则获取最新联系人列表
    var exhibitionid = wx.getStorageSync('exhibitionid')
    var toid = that.data.toid
    var u = wx.getStorageSync('u')
    console.log('exhibitionid=' + exhibitionid)
    console.log('u=' + u)
    console.log('toid=' + toid)
    if (!(exhibitionid == '0' && u == '0')) {
      //默认最新（调用pico接口）
      var timestamp = Date.parse(new Date());
      timestamp = timestamp / 1000;
      var url = app.globalData.picoaddress + '/attendee/exhibitors/contactme'
      var k = {}
      k["v"] = '1.0.0'
      k["client"] = 'ios'
      k["timestamp"] = timestamp
      k["lan"] = 'cn'
      k["exhibitionid"] = exhibitionid
      k["toid"] = toid
      k["u"] = u

      var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'timestamp' + timestamp + 'toid' + toid + app.globalData.picotoken
      console.log(sign)
      var curb64 = md5.hexMD5(sign)
      console.log(curb64)
      k["sign"] = curb64
      wx.request({
        header: {
          'content-type': 'application/x-www-form-urlencoded',
        },
        url: url,
        method: 'post',
        data: k,
        success(res) {
          console.log(res)
          var mesg = res.data
          console.log('mesg=' + mesg)
          if (mesg.code == 200) {
            that.setData({
              luzsshow: true
            })      
          } else {
            wx.showToast({
              title: mesg.message,
              icon: 'none',
              duration: 1500
            })
          }

        },
        fail: res => {
          console.log(res, "error")
        }

      })


    } else {
      wx.navigateTo({
        url: '../signInbyPhone/signIn'
      })
    }
  },
  hqmp: function () {
    var that = this;
    //获取缓存展会id和用户id存在则获取最新联系人列表
    var exhibitionid = wx.getStorageSync('exhibitionid')
    var exhibitorid = that.data.exhibitorid
    var toid = that.data.toid
    var u = wx.getStorageSync('u')
    console.log('exhibitionid=' + exhibitionid)
    console.log('u=' + u)
    if (!(exhibitionid == '0' && u == '0')) {
      //默认最新（调用pico接口）
      var timestamp = Date.parse(new Date());
      timestamp = timestamp / 1000;
      var url = app.globalData.picoaddress + '/attendee/exhibitors/getexhibitorcard'
      var k = {}
      k["v"] = '1.0.0'
      k["client"] = 'ios'
      k["timestamp"] = timestamp
      k["lan"] = 'cn'
      k["exhibitionid"] = exhibitionid
      k["exhibitorid"] = exhibitorid
      k["u"] = u

      var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'exhibitorid' + exhibitorid + 'timestamp' + timestamp + app.globalData.picotoken
      console.log(sign)
      var curb64 = md5.hexMD5(sign)
      console.log(curb64)
      k["sign"] = curb64
      wx.request({
        header: {
          'content-type': 'application/x-www-form-urlencoded',
        },
        url: url,
        method: 'post',
        data: k,
        success(res) {
          console.log(res)
          var mesg = res.data
          console.log('mesg=' + mesg)
          if (mesg.code == 200) {
            wx.showToast({
              title: '展商名片成功添加到通讯录',
              icon: 'none',
              duration: 1500
            })
            wx.navigateTo({
              url: '../pageDetail/pageDetails?attendeeid=' + toid,
            })

          } else {
            wx.showToast({
              title: mesg.message,
              icon: 'none',
              duration: 1500
            })
          }
        },
        fail: res => {
          console.log(res, "error")
        }

      })


    } else {
      wx.navigateTo({
        url: '../signInbyPhone/signIn'
      })
    }
  },
  yjzs: function () {
    var that = this;
    //获取缓存展会id和用户id存在则获取最新联系人列表
    var exhibitionid = wx.getStorageSync('exhibitionid')
    var toid = that.data.toid
    var fullname = that.data.fullname
    var u = wx.getStorageSync('u')
    console.log('exhibitionid=' + exhibitionid)
    console.log('u=' + u)
    if (!(exhibitionid == '0' && u == '0')) {
      //默认最新（调用pico接口）
      var timestamp = Date.parse(new Date());
      timestamp = timestamp / 1000;
      var url = app.globalData.picoaddress + '/attendee/exhibitors/appointment'
      var k = {}
      k["v"] = '1.0.0'
      k["client"] = 'ios'
      k["timestamp"] = timestamp
      k["lan"] = 'cn'
      k["exhibitionid"] = exhibitionid
      k["toid"] = toid
      k["u"] = u

      var sign = app.globalData.picotoken + 'clientiosexhibitionid' + exhibitionid + 'timestamp' + timestamp + 'toid' + toid + app.globalData.picotoken
      console.log(sign)
      var curb64 = md5.hexMD5(sign)
      console.log(curb64)
      k["sign"] = curb64
      wx.request({
        header: {
          'content-type': 'application/x-www-form-urlencoded',
        },
        url: url,
        method: 'post',
        data: k,
        success(res) {
          console.log(res)
          var mesg = res.data
          console.log('mesg=' + mesg)
          if (mesg.code == 200) {
            wx.showToast({
              title: '约见展商消息已成功发出，等待展商确认',
              icon: 'none',
              duration: 2000
            })
            wx.navigateTo({
              url: '../contactsModule/chat?attendeeid=' + toid+'&nickname='+fullname,
            })

          } else {
            wx.showToast({
              title: mesg.message,
              icon: 'none',
              duration: 2000
            })
          }
        },
        fail: res => {
          console.log(res, "error")
        }

      })


    } else {
      wx.navigateTo({
        url: '../signInbyPhone/signIn'
      })
    }
  },

})